<?php

$travellers = array();

if (! empty($event['EventConductor'])) {
    $travellers[] = $event['EventConductor']['Member'];
    $travellers[0] = array_merge($travellers[0], $event['EventConductor']);
}

if (! empty($event['Member'])) {
    $travellers = array_merge($travellers, $event['Member']);
}

if (! empty($event['Guest'])) {
    $travellers = array_merge($travellers, $event['Guest']);
}

?>

<button class="btn-print fixed no-print" onclick="window.print()"><?= __('Print') ?></button>
<h1><?= strtotitle(__('travellers'))  ?></h1>
<table>
<tr>
    <th width="1%"></th>
    <th><?= strtotitle(__('name')) ?> <? __('and') ?> <?= strtotitle(__('surname')) ?></th>
    <th><?= strtotitle(__('voice')) ?>
    <th><?= strtotitle(__('contact info')) ?>
    <th><?= strtotitle(__('address')) ?>
    <th><?= strtotitle(__('passport')) ?>
    <th><?= mb_strtoupper(__('jmbg')) ?>
    <th><?= strtotitle(__('birthday')) ?>
</tr>

<? foreach ($travellers as $k=>$traveller): ?>
<tr>
    <td align="right"><?= $k+2 ?>.</td>
    <td><?= $traveller['name'] ?></td>
    <td><?= __($traveller['voice']) ?></td>
    <td>
        <?= @implode('<br>', Set::extract('{n}.MemberContact.contact_value', $traveller['MemberContact'])) ?>
    </td>
    <td>
        <?= $traveller['address'] ?><? if (! empty($traveller['city'])): ?>,
            <?= $traveller['city'] ?>
        <? endif ?>
    </td>
    <td>
        <?= $traveller['passport_number'] ?><? if (! empty($traveller['passport_country'])): ?>,
            <?= $traveller['passport_country'] ?>
        <? endif ?>
    </td>
    <td><?= $traveller['jmbg'] ?></td>
    <td><?= date_local($traveller['birthday']) ?></td>
</tr>
<? endforeach ?>

</table>
